import 'package:enterprise_v6_app/app/core/core.dart';

/// 安全基础通用使用
class BasicCommonWidget {
  /// 获取台账通用状态
  /// 获取状态显示 状态 1:待发起 2:待审批3：审批中 4：通过 5：驳回
  static Widget getCommonStateView(int state) {
    String? stateText;
    Color? color;
    switch (state) {
      case 1:
        stateText = '待发起';
        color = const Color(0xFF0ED0D0);
        break;
      case 2:
        stateText = '待审批';
        color = const Color(0xFFFFA500);
        break;
      case 3:
        stateText = '审批中';
        color = const Color(0xFFB9B907);
        break;
      case 4:
        stateText = '通过';
        color = const Color(0xFF0FCE0F);
        break;
      case 5:
        stateText = '已驳回';
        color = const Color(0xFFF61515);
        break;
    }
    return Container(
      alignment: Alignment.center,
      height: 18.w,
      width: 52.w,
      decoration: BoxDecoration(
        color: color ?? Colors.white,
        borderRadius: BorderRadius.only(
          topRight: Radius.circular(20.w),
          topLeft: Radius.circular(20.w),
          bottomRight: Radius.circular(20.w),
        ),
      ),
      child: Text(
        stateText ?? '',
        style: TextStyle(
          fontSize: 10.sp,
          fontWeight: FontWeight.w400,
          color: Colors.white,
        ),
      ),
    );
  }
}
